Default to OAS-compliant handling of additionalProperties#21170
Open
ctreatma wants to merge 7 commits intoOpenAPITools:masterfrom
Open
Default to OAS-compliant handling of additionalProperties#21170ctreatma wants to merge 7 commits intoOpenAPITools:masterfrom
ctreatma wants to merge 7 commits intoOpenAPITools:masterfrom
Conversation
7c220fc to
b38c2fb
Compare
Contributor
Author
|
@wing328 When you have a moment, please take a look. To provide a more complete fallback for this change, I added a new config flag for Python generators to maintain pre-existing behavior around the |
ctreatma
commented
May 1, 2025
ctreatma
commented
May 1, 2025
ctreatma
commented
May 1, 2025
9b01374 to
69520f0
Compare
6 tasks
9ef6192 to
2d4fb51
Compare
6e1a59c to
6760d99
Compare
6760d99 to
f9aa3a6
Compare
f9aa3a6 to
6ecb775
Compare
f87100e to
745c360
Compare
…erting them all at once
745c360 to
d061943
Compare
Contributor
Author
|
@wing328 please let me know if there's anything I can do to help shepherd this proposal through review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the default value for
disallowAdditionalPropertiesIfNotPresentfromtruetofalse, which means that the generator will now, by default, produce code that complies OpenAPI standards with respect to the handling ofadditionalProperties.Note that a number of example configs did not have to be updated as a result of this change, which indicates that the
disallowAdditionalPropertiesIfNotPresentoption had no effect on the generators used in those examples.Some of the Python templates had references to
{{#disallowAdditionalPropertiesIfNotPresent}}. It turns out that this check behaves differently if users leavedisallowAdditionalPropertiesIfNotPresentunspecified than it does if users explicitly configuredisallowAdditionalPropertiesIfNotPresent: true. That means that swapping the default would be a breaking change for Python generators. To work around that, I've introduced a newlegacyDisallowAdditionalPropertiesDefaultBehaviorflag that is used by the impacted Python generators. Users who were using the impacted generators and were not explicitly configuringdisallowAdditionalPropertiesIfNotPresentcan continue to generate equivalent code by setting these options:Closes #21169
Closes #21121, closes #21446 (by making expected behavior documented in those issues the default rather than requiring explicit config)
Closes #16575 (duplicate)
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)